package com.woniuxy.yogaapp.mapper;

import com.woniuxy.yogaapp.pojo.Friends;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 操作好友表
 */
public interface FriendsMapper {

    /**
     * 数据库中添加好友
     * @param friends
     * @return
     */
    @Insert("insert into friends(me,friend,fname,fimage,roles) values (#{me},#{friend},#{fname},#{fimage},#{roles})")
    int addFriends(Friends friends);

    /**
     * 取消好友
     * @param me
     * @param other
     * @return
     */
    @Delete("delete from friends where me = #{param1} and friend = #{param2}")
    int deleteFriends(Integer me, Integer other);

    /**
     * 查询用户的所有好友的信息
     *
     * @param uid
     * @return
     */
    @Select("select me,friend,fname,fimage,roles  from friends where me = #{uid}")
    List<Friends> findFriendsByUid(Integer uid);

}
